package homework;

import java.util.ArrayList;
import java.util.Collections;

public class number2 {
public static void main(String[] args) {
	ArrayList<String> list = new ArrayList<String>();
	ArrayList<String> list1 = new ArrayList<String>();
	Collections.addAll(list, "张无忌-男-15", 
			"周芷若-女-14", "赵敏-女-13", "张强-男-20",
			"张三丰-男-100", "张翠山-男-40","张良-男-35","王二麻子-男-35",
			"谢广坤-女-41","林婷-女-22","林立-女-23");
	System.out.println(list);
	int value = 0;
	//先过滤男演员
	for(String s: list) {
		String[] spiltarr = s.split("-"); 
		//判断条件
		if("男".equals(spiltarr[1]) && spiltarr[0].length() == 3 && value < 3) {
			Collections.addAll(list1, s);
			value++;
		}
	}
    value = 0;
	//在过滤女演员
	for(String s: list) {
		String[] spiltarr = s.split("-");
		if("女".equals(spiltarr[1])&& spiltarr[0].startsWith("林")) {
			value++;
			if(value>1) {
				Collections.addAll(list1, s);
			}
		}
	}
	System.out.println(list1);
	
	
	
}
}
